/**
 * 
 */
package org.kang.myhadoop;

import java.io.IOException;
import java.util.StringTokenizer;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/**
 * 
 * @author yanglk <br>
 *         <a href="mailto:yanglk2010@sina.com">yanglk2010@sina.com</a>
 * @Time 2017年6月7日 下午3:50:48
 * @since 1.0
 * @version 1.0
 */
public class MapClass extends Mapper<LongWritable, Text, Text, IntWritable>{
	
	private static final IntWritable one = new IntWritable(1);
	private Text word = new Text();
	
	@Override
	public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException{
		String line = value.toString();
		StringTokenizer st = new StringTokenizer(line, " ");
		while(st.hasMoreTokens()){
			word.set(st.nextToken());
			context.write(word, one);
		}
	}

}
